package handler

import (
	"log"
	"paper-parser/model"
)

func SectionUpdate(name string) {
	section := new(model.Section)
	sections, err := section.SomeLike(name)
	if err != nil {
		log.Fatal(err)
	}
	for k, s := range sections {
		switch name {
		case "知觉速度":
			s.Name = "知觉速度与准确性"
			s.Type = "Perception"
			s.Deduct = true
			s.TotalScore = 6
			s.EveryScore = 0.1
			s.Duration = 8
			s.Group = 5
		case "常识":
			s.Name = "常识判断"
			s.Type = "CommonSense"
			s.Deduct = false
			s.TotalScore = 10
			s.EveryScore = 0.5
			s.Duration = 15
			s.Group = 1
		case "言语理解":
			s.Name = "言语理解与表达"
			s.Type = "Expression"
			s.Deduct = false
			s.TotalScore = 24
			s.EveryScore = 0.8
			s.Duration = 25
			s.Group = 1
		case "数量关系":
			s.Name = "数量关系"
			s.Type = "Quantitation"
			s.Deduct = false
			s.TotalScore = 8
			s.EveryScore = 0.8
			s.Duration = 15
			s.Group = 1
		case "数理能力":
			s.Name = "数理能力"
			s.Type = "Quantitation"
			s.Deduct = false
			s.TotalScore = 8
			s.EveryScore = 0.8
			s.Duration = 15
			s.Group = 1
		case "判断推理":
			s.Name = "判断推理"
			s.Type = "Inference"
			s.Deduct = false
			s.TotalScore = 32
			s.EveryScore = 0.8
			s.Duration = 35
			s.Group = 1
		case "逻辑判断":
			s.Name = "逻辑判断"
			s.Type = "Inference"
			s.Deduct = false
			s.TotalScore = 32
			s.EveryScore = 0.8
			s.Duration = 35
			s.Group = 1
		case "科学推理":
			s.Name = "科学推理"
			s.Type = "Inference"
			s.Deduct = false
			s.TotalScore = 32
			s.EveryScore = 0.8
			s.Duration = 35
			s.Group = 1
		case "类比推理":
			s.Name = "类比推理"
			s.Type = "Inference"
			s.Deduct = false
			s.TotalScore = 32
			s.EveryScore = 0.8
			s.Duration = 35
			s.Group = 1
		case "综合知识":
			s.Name = "综合知识"
			s.Type = "DataAnalysis"
			s.Deduct = false
			s.TotalScore = 20
			s.EveryScore = 1
			s.Duration = 20
			s.Group = 1
		case "综合基础知识":
			s.Name = "综合基础知识"
			s.Type = "DataAnalysis"
			s.Deduct = false
			s.TotalScore = 20
			s.EveryScore = 1
			s.Duration = 20
			s.Group = 1
		case "综合分析能力":
			s.Name = "综合分析能力"
			s.Type = "DataAnalysis"
			s.Deduct = false
			s.TotalScore = 20
			s.EveryScore = 1
			s.Duration = 20
			s.Group = 1
		case "资料分析":
			s.Name = "资料分析"
			s.Type = "DataAnalysis"
			s.Deduct = false
			s.TotalScore = 20
			s.EveryScore = 1
			s.Duration = 20
			s.Group = 1
		default:
			return
		}
		err := s.UpdateCols("name", "deduct", "total_score", "every_score", "duration", "group", "type")
		if err != nil {
			log.Println(err)
		}
		log.Println("no.", k, "section update success")
	}
}
